% reference

(de linkify (src &optional text)
  (dom-append (dom-create "a" (list (cons "href" src))) 
              (cond ((null text) src)
                    (t text))))

(de make-toc-entry (topic)
  (prog (topicstr)
    (setq topicstr (to-string topic))
    (return (linkify (string-concat "#" topicstr)
                     (string-concat topicstr "<br>")))))

(de make-content (topic)
  (prog (topicstr element)
    (setq topicstr (to-string topic))
    (setq element (dom-create "a" (list (cons "name" topicstr))))
    (dom-append element topicstr "<br>" (arg-info topic) "<br><br>"
                        (car (help topic)) "<hr>")
    (return element)))

(prog (body toc content topics)
  (setq body (dom-get-body))
  (setq toc (dom-create "div"))
  (setq content (dom-create "div"))
  (setq topics (id-sort (help)))
  (dom-set-title "substandard lisp builtin reference")
  (apply 'dom-append (cons toc (mapcar topics #'make-toc-entry)))
  (apply 'dom-append (cons content (mapcar topics #'make-content)))
  (dom-append body "substandard lisp currently has " (length topics)
                   " builtins. the following is an alphabetical list "
                   "and the help text for each"
                   toc "<br>" content))
